package ${namespace}.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ${namespace}.dao.${bclazz}Dao;
import ${namespace}.entity.${clazz};
import ${namespace}.service.${bclazz}Service;

import com.solution.common.dao.BaseDao;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;
import com.solution.common.service.impl.BaseServiceImpl;
import com.solution.common.utils.string.StringUtil;

/**
 * ${comment}service实现层
 * @author ${author}
 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
 */
@Service
public class ${bclazz}ServiceImpl extends BaseServiceImpl<${clazz}> implements ${bclazz}Service {

	/**
	 * ${comment}接口
	 */
	@Autowired
	private ${bclazz}Dao ${sclazz}Dao;

	protected BaseDao<${clazz}> getDao() {
		return this.${sclazz}Dao;
	}

	/**
	 * 保存${comment}
	 * @param ${sclazz}Entity ${comment}实体
	 * @return Long 添加成功${comment}的ID
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	public long save${bclazz}(${clazz} ${sclazz}Entity) {
		return ${sclazz}Dao.save${bclazz}(${sclazz}Entity);
	}

	/**
	 * 分页查询${comment}
	 * @param pageParam 分页参数
	 * @param paramMap 查询参数
	 * @return PageBean 分页参数和分页数据
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	@Override
	public PageBean list${bclazz}Page(PageParam pageParam, Map<String, Object> paramMap) {
		return ${sclazz}Dao.list${bclazz}Page(pageParam, paramMap);
	}
	
	/**
	 * 根据ID查询用户信息
	 * @param id 用户id
	 * @return ${sclazz}Entity 用户对象
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	public ${clazz} get${bclazz}ById(Long id) {
		return ${sclazz}Dao.getById(id.longValue());
	}

	/**
	 * 更新用户
	 * @param ${sclazz}Entity 用户实体
	 * @return Long 更新是否成功，>1代表更新成功
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	@Override
	public int update${bclazz}(${bclazz}Entity ${sclazz}Entity) {
		return ${sclazz}Dao.update${bclazz}(${sclazz}Entity);
	}
	
	
	/**
	 * 根据条件查询${comment}
	 * @param param
	 * @return 数据列表
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	@Override
	public List<${bclazz}Entity> list${bclazz}( Map<String, Object> param){
		return  ${sclazz}Dao.list${bclazz}(param);
	}
	
	/**
	 * 删除${comment}
	 * @param 
	 * @return int 返回删除记录条数
	 * @author ${author}
	 * @date ${.now?string("yyyy-MM-dd HH:mm:ss")}
	 */
	public int delete${bclazz}ById(long id){
		return  ${sclazz}Dao.deleteById(id);
	}
	
}
